//引用两个函数 一个是创建路由的createRouter createWebHistory路由模式
import {createRouter,createWebHistory} from 'vue-router'

const Body = ()=>import('../views/body/Body.vue');
/* 分页组件 */
const Home = ()=>import('../views/main/Home/home.vue')
const order = ()=>import('../views/main/order/order.vue')
const discover = ()=>import('../views/main/discover/discover.vue')
const mine = ()=>import('../views/main/mine/mine.vue')
const Detail = ()=>import('@comps/detail/Details.vue')
const Menu = ()=>import('@comps/detail/menu/Menu.vue')
const Merchant = ()=>import('@comps/detail/merchant/Merchant.vue')
const Evaluate = ()=>import('@comps/detail/evaluate/Evaluate.vue')

const routes = [
	{
		path:'/',
		redirect:'/home'
	},
	{
		path:'/',
		name:'Body',
		component:Body,
		//配置子路由
		children:[
			{
				path:'home',
				name:'HOME',
				component:Home
			},
			{
				path:'mine',
				name:'MINE',
				component:mine
			},
			{
				path:'order',
				name:'ORDER',
				component:order
			},
			{
				path:'discover',
				name:'DISCOVER',
				component:discover
			},
		]
	},
	{
		path:'/detail',
		name:'DETAIL',
		component:Detail,
		children:[
			{
				path:'menu',
				mame:'MENU',
				component:Menu
			},
			{
				path:'merchant',
				mame:'MERCHANT',
				component:Merchant
			},
			{
				path:'evaluate',
				mame:'EVALUATE',
				component:Evaluate
			},
		]
	}
]
const router= createRouter({
	history:createWebHistory(),//mode:'history'
	routes
})

export default router;